package com.seele.tigerwallet.ui.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseItemDraggableAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.seele.tigerwallet.R;
import com.seele.tigerwallet.async.Log;
import com.seele.tigerwallet.model.AssetsModel;
import com.seele.tigerwallet.model.UserInfo;
import com.seele.tigerwallet.ui.callback.ItemMoveListener;
import com.seele.tigerwallet.ui.manager.GlideManager;
import com.seele.tigerwallet.ui.utils.DataUtils;
import com.seele.tigerwallet.ui.utils.SPUtils;
import com.seele.tigerwallet.ui.utils.TypefaceUtils;

import java.util.Collections;
import java.util.List;

public class AssetsAdapter extends BaseQuickAdapter<AssetsModel, BaseViewHolder> {


    public AssetsAdapter(List<AssetsModel> data) {
        super(R.layout.item_assets,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AssetsModel item) {
        try {
            if (!TextUtils.isEmpty(item.symbol)) {
                helper.setText(R.id.token_name_tv, item.symbol);
            }

            helper.setText(R.id.token_balance_tv, DataUtils.getFourDecimal(item.balance));

            TextView token_balance_tv = helper.getView(R.id.token_balance_tv);
//            TypefaceUtils.setFuturaMediumBT(token_balance_tv,mContext);
            String total = DataUtils.getSingleTokenValue(item.price, item.balance);
            helper.setText(R.id.token_total_tv,"≈ "+DataUtils.getCompanySymbol()+total);
            ImageView imageView = helper.getView(R.id.token_icon_img);

            GlideManager.loadUrl(mContext, item.id+"", imageView);

        } catch (Exception e) {
            e.printStackTrace();
        }


    }

}
